function flashCode(objct) {
    $(objct).attr("src", "http://localhost:8080/code?date="+new Date());
}

function login() {
    let username=$("#username").val();
    let password=$("#password").val();
    let code=$("#code").val();

    let data=myAjax("/login",{username:username,password:password,code:code},"post")
    if (data.result==1) {
        window.open("/back/manage.html");
    }else if (data.result==0) {
        alert("登录失败，用户名或者密码不正确请重新输入")
    }else if (data.result==-1) {
        alert("验证码错误")
    }
}

//回车键触发事件
document.onkeydown =cdk;
function cdk(){
    if(event.keyCode ==13){
        login();
    }
}